<%@ page language="java" contentType="text/javascript; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@page import='java.sql.*' %>
<%@page import="java.util.ArrayList"%>
<%@page import="net.sf.json.JSONObject"%>
<%@page import="net.sf.json.JSONSerializer"%>
<%@page import="net.sf.json.JSONArray"%>

<%String callback = request.getParameter("callback");%>
<%=callback %> (<%

	String id = request.getParameter("id");
	String route = request.getParameter("route");
	String start = request.getParameter("startdate");
	String end = request.getParameter("enddate");
	
	Connection conn = null;
	PreparedStatement pstmt = null;
	
	try{
		Class.forName("com.mysql.jdbc.Driver");
		conn = DriverManager.getConnection(
			"jdbc:mysql://localhost/itscreater", "itscreater", "campus123");
		
		String insert = "insert into UserRoute" +
						"(ID, Route, StartDate, EndDate)" +
						"values (?, ?, ?, ?);";
		pstmt = conn.prepareStatement(insert);
		pstmt.setString(1, id);
		pstmt.setString(2, route);
		pstmt.setString(3, start);
		pstmt.setString(4, end);
		pstmt.executeUpdate();
	}
	
	finally{
		try{
			pstmt.close();
		}
		catch (Exception ignored){
		}
		try{
			conn.close();
		}
		catch (Exception ignored){
		}
	}
%>);